package com.ms.game.rebate;

import java.util.HashMap;

/**
 * 回饋金的類型
 */
public enum RebateType {
	COMMISSION(1, "邀請好友抽佣"),
	MONTHLY_FEE_FIREST_PAY(2, "包月當下配發") ,
	MONTHLY_FEE_DAILY_PAY(3, "包月每日配發"),
	UPLINE_INVITE_AWARD(4,"上線邀請獎勵"),
	UPLINE_INVITE_AWARD_DISTRIBUTOR(5,"上線邀請獎勵(經銷商)"),
	WEEKLY_FEE_FIREST_PAY(6, "包週當下配發") ,
	WEEKLY_FEE_DAILY_PAY(7, "包週每日配發");
	private RebateType(int id, String desc) {
		this.id = id;
		this.desc = desc;
	}
	
	private static HashMap<Integer, RebateType> rebateTypeMap = new HashMap<Integer, RebateType>();
	
	public static RebateType getRebateTypeById(int id){
		if(!rebateTypeMap.containsKey(id)){
			return null;
		}
		
		return rebateTypeMap.get(id);
		
	}

	static {
		for (RebateType type : RebateType.values()) {
			rebateTypeMap.put(type.getId(), type);
		}
	} 

	/**
	 * id
	 */
	private int id;

	/**
	 * 註解
	 */
	private String desc;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDesc() {
//		return desc;
		return this.name();//20160518 改成回傳enum.name()
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
}
